<template>
	<view class="page container">
<!-- 		<z-paging :refresher-enabled="false" :auto-full-height="false" :default-page-size="15" ref="pagingRef"
			v-model="dataList" @query="queryList" :paging-style="{ 'background-color': 'transparent' }"> -->
			 <view class="h-28" ></view> 
			<u-overlay :show="overlay_show" @click="clickOverlay" :zIndex="2"></u-overlay>
			<view class="list " >
				<!---->
				<view class="item bgc-fff pad-28" v-for="(item, index) in dataList" :key="index"
					@click="$utils.to(`/pages/scoreDetail/index?id=${item.id}`)">
					<view class="w-294 h-256  br-12" style="overflow: hidden; min-width: 276rpx">
						<image style="width: 100%; height: 100%"  mode="aspectFit" :src="$config.domain+item.images">
						</image>
					</view>
					<view class="texts">
						<view>
							<view class="flex-between-center">
								<view style="width: 100%">
									<u-text :lines="1" size="28rpx" color="#374151" :text="item.title || ''"></u-text>
								</view>

							</view>
						
						</view>
						<view class="mt-12   c-D61F1F" style="color:#D61F1F;">
							<text class="fs-32  mr-8" style="color:#D61F1F;">{{item.point}}</text>
						 <text class="fs-24">积分+¥{{item.amount}}</text>	
						</view>
						<view class="flex" style="justify-content: flex-end;">
							<view class="w-176 mt-12 h-56 br-8 c-fff fs-28  flex-center-center btn-active"
									style="background: #E61E1E;">
								立即兑换
							</view>
						</view>
						
					</view>
					<!-- <view class="detail-btn w-124 h-60 br-12 flex-center-center">详情</view> -->
				</view>
			</view>
			<!-- <view v-else>
				<LandMap type="garden" ref="landMap" :data="dataList" @markerClick="handleMarkerClick" />
			</view> -->
		<!-- </z-paging> -->
	</view>
</template>

<script>
	import ScoreScreen from "@/components/ScoreScreen/index.vue";
	import LandMap from "@/components/LandMap.vue";
	import {
		getProductList
	} from "@/services/home.js";
	export default {
		components: {
			ScoreScreen,
			LandMap,
		},
		data() {
			return {
				overlay_show: false,
				viewType: "list",
				dataList: [
				],
				params: {
					title: "",
					lat: "",
					lng: "",
				},
				selectedValues: {},
			};
		},
		onLoad() {
			//获取当前经纬度
			console.log(this.n)
			
			// this.$refs.pagingRef?.reload();
			this.queryList()
			 
		},
		
		methods: {
			onScreen(e) {
				const {
					area,
					distance,
					views
				} = e;
				const [city, district, town, village] = area;
				this.selectedValues = this.$options.data.selectedValues; //先还原
				const requestObj = {
					city: this.filterAll(city),
					district: this.filterAll(district),
					town: this.filterAll(town),
					village: this.filterAll(village),
					order_sort: {
						distance,
						see_num: views
					},
				};
				this.selectedValues = requestObj;
				this.$refs.pagingRef?.reload();
			},
			overlayShow(e) {
				this.overlay_show = e;
			},
			clickOverlay() {
				this.$refs.screenRef.overlay_show = false;
			},
			handleMarkerClick(item) {
				this.$utils.to(`/pages/scoreDetail/index?id=${item.id}`);
			},
			handleSearch() {
				this.$refs.pagingRef?.reload();
			},
			queryList(page, size) {
				
				
				getProductList().then((res) => {
					
				  // this.$refs.pagingRef?.complete(res.data?.data || []);
				  this.dataList=res.data
				});
			},
			changeViewType(type) {
				this.viewType = type;
				this.$refs.pagingRef?.reload();
			},
			handleFilterChange({
				type,
				value
			}) {
				this.selectedValues[type] = value;
				this.$refs.pagingRef?.reload();
			},
			filterAll(e) {
				if (["all4", "all3", "all2", "all1"].includes(e)) {
					return "";
				}
				return e;
			},
		},
	};
</script>

<style lang="scss" scoped>
	.filter-container {
		display: flex;
		width: 100%;
		background-color: #fff;
		position: relative;
		z-index: 100;
	}

	.filter-tab {
		flex: 1;
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 12px 0;

		.arrow {
			font-size: 12px;
			margin-left: 4px;
			transition: transform 0.3s;
			color: #999;

			&.arrow-up {
				transform: rotate(180deg);
			}
		}
	}

	.page {
		background-color: #EFEFEF;

		.page-top {
			padding-bottom: 28rpx;

			.search-box {
				position: relative;
				z-index: 999;
			}
		}

		.filter-wrapper {
			position: relative;
			z-index: 100;
		}

		.list {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			padding: 0 20rpx;
			.item {
				display: flex;
				align-items: center;
				position: relative;
				flex-direction: column;
				width: 340rpx;
				margin-bottom: 32rpx;
				box-sizing: border-box;
				border-radius: 16rpx;
				.detail-btn {
					position: absolute;
					right: 28rpx;
					bottom: 28rpx;
					font-size: 24rpx;
					font-weight: 500;
					color: #fff;
					background-color: $theme_color;
				}

				.texts {
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					flex: 1;
					width: 100%;
					margin-top: 16rpx;
					// height: 216rpx;
					// margin-left: 24rpx;

					&>view {
						font-size: 28rpx;

						&>text:first-child {
							color: #677585;
						}
					}
				}
			}
		}
	}

	.tabs {
		font-weight: 400;
		font-size: 28rpx;
		margin: 30rpx;
		color: #3C3C3C;

		.on {
			font-weight: 700;
			font-size: 28rpx;
			color: #E61E1E;
		}
	}
</style>